#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
const int inf=0x3f3f3f3f;
int minb=inf;
 
void dfs(int dep,int k,int sum,int cnt){
    if(dep==k){
        if(sum==cnt){
            minb=min(minb,sum);
        }
        if(sum+1==cnt+1){
            minb=min(minb,sum+1);
        }
        return;
    }
    if(dep==1){
        dfs(dep+1,k,(sum+1)<<1,cnt+1);
        return;
    }
    if(minb!=inf)return;
    dfs(dep+1,k,sum<<1,cnt);
    if(minb!=inf)return;
    dfs(dep+1,k,(sum<<1)+1,cnt+1);
    if(minb!=inf)return;
}
 
string to2(int b){
    string res="";
    while(b>0){
        if(b&1)res='1'+res;
        else res='0'+res;
        b>>=1;
    }
    if(res=="")return "0";
    return res;
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T=1;
    cin>>T;
    for(int _=0;_<T;_++){
        int n,k,cnt=0;
        minb=inf;
        cin>>n>>k;
        string a;
        cin>>a;
        for(int i=0;i<n;i++){
            if(a[i]=='1') cnt++;
        }
        dfs(1,k,0,cnt);
        if(minb==inf){
            cout<<"None"<<'\n';
        }
        else {
            cout<<to2(minb)<<'\n';
        }
    }
    return 0;
}